package com.heqiang.spring;

import com.heqiang.spring.context.support.ClassXmlApplicationContext;
import com.heqiang.spring.service.TestService;
import com.heqiang.spring.service.event.CustomEvent;
import org.openjdk.jol.info.ClassLayout;

/**
 * 学习链接
 * https://mp.weixin.qq.com/s/wf5XiY4AjFETLQZxEwcCEQ
 * spring的事件，与事件监听
 */
public class TestMain {


    /***
     * 发布事件
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception{

        String xml = "classpath:spring.xml";
        ClassXmlApplicationContext applicationContext = new ClassXmlApplicationContext(xml);

        applicationContext.publishEvent(new CustomEvent(applicationContext,1234543423L,"事件成功了！"));

        applicationContext.registerShutdownHok();

    }





}
